import {SidebarProvider} from "@/components/ui/sidebar";
import {cookies} from "next/headers";
import {AppSidebar} from "@/components/sidebar/app-sidebar";

export default async function HomeLayout({children}: { children: React.ReactNode; }) {
    const cookieStore = await cookies()
    const defaultOpen = cookieStore.get("sidebar:state")?.value === "true"

    return (
        <SidebarProvider defaultOpen={defaultOpen}>
            <AppSidebar/>
            {children}
        </SidebarProvider>
    );
}
